<%@ page import="pro.ccy.JdbcUtils" %>
<%@ page import="pro.wyn.pojo.Goods" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<%
    String sql="SELECT id,`name`,price,image FROM `goods`;";
    List<Goods> goods = JdbcUtils.selects(sql, Goods.class);
%>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java实训团队协作简单案例 - 商品列表页面</title>
    <link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/vendors/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/core.css" />
    <link rel="stylesheet" href="assets/css/index.css" />

    <link rel="stylesheet" href="assets/css/goods.css" />
</head>

<body>
    <jsp:include page="/WEB-INF/tpl/wyn/header.jsp"/>
    <section class="container">
        <jsp:include page="/WEB-INF/tpl/wyn/left.jsp"/>
        <div class="main-right">
            <h3>商品列表页面</h3>
            <a href="goods-edit.jsp"><i class="fa fa-plus"></i> 新增商品</a>
            <div class="goods-container">
                <% for(Goods good:goods){ %>
                <div class="goods-item">
                    <img class="goods-img" src="/images/<%=good.getImage()%>" />
                    <span class="goods-price"><%=good.getPrice()%></span>
                    <span class="goods-title"><%=good.getName()%></span>
                    <span class="goods-footer">
                        <i class="fa fa-pencil"></i>
                        <i class="fa fa-trash"></i>
                    </span>
                </div>
               <% } %>

            <div class="goods-pager">
                <span>总共 <b>30</b> 条数据，当前是第 <b>1</b> 页。</span>
                <button type="button">上一页</button>
                <button type="button">下一页</button>
            </div>
        </div>
    </section>
</body>

</html>